const _errorInner = uni.createInnerAudioContext();
_errorInner.autoplay = false;
_errorInner.src = require('@/static/audio/error.mp3') 

const _successInner = uni.createInnerAudioContext();
_successInner.autoplay = false;
_successInner.src = require('@/static/audio/success.mp3')

const _complateInner = uni.createInnerAudioContext();
_complateInner.autoplay = false;
_complateInner.src = require('@/static/audio/complate.mp3')



document.addEventListener('WeixinJSBridgeReady',()=>{
    _errorInner._audio.load()
    _successInner._audio.load()
    _complateInner._audio.load()
},false)


export default{
    success(){
        _successInner.pause()
        _successInner.startTime=0
        _successInner.play()
    },
    complate(){
        
        _complateInner.pause()
        _complateInner.startTime=0
        _complateInner.play()
    },
    error(){
        _errorInner.pause()
        _errorInner.startTime=0
        _errorInner.play()
        
    },
    getAgent(){
    	var ua = navigator.userAgent,
    		isWindowsPhone = /(?:Windows Phone)/.test(ua),
    		isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,
    		isAndroid = /(?:Android)/.test(ua),
    		isFireFox = /(?:Firefox)/.test(ua),
    		isChrome = /(?:Chrome|CriOS)/.test(ua),
    		isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox &&
    			/(?:Tablet)/.test(ua)),
    		isPhone = /(?:iPhone)/.test(ua) && !isTablet,
    		isPc = !isPhone && !isAndroid && !isSymbian;
    	return {
    		isTablet: isTablet,
    		isPhone: isPhone,
    		isAndroid: isAndroid,
    		isPc: isPc
    	};
    }
}